
<div class="bjui-pageContent">
    <form action="${wwwroot}/admin/agent/save" id="editForm" data-toggle="validate" data-alertmsg="false" reloadNavtab="true">
        <input type="hidden" name="id" value="${(agent.id)!}" />
        <div class="pageFormContent" data-layout-h="0">
            <table class="table table-condensed table-hover" width="100%">
                <tbody>
                <tr>
                    <td>
                        <label for="name" class="control-label x85">代理名：</label>
                        <input type="text" name="name" id="name" value="${(agent.name)!}" data-rule="required" >
                    </td>
                    <td>
                        <label for="ip" class="control-label x85">ip：</label>
                        <input type="text" name="ip" id="ip" value="${(agent.ip)!}"  >
                    </td>
                    <td>
                        <label for="sysRank" class="control-label x85">系统级别：</label>
                    <@p.selector sysRanks 'name' 'name' agent 'sysRank' 'sysRankName'/>
                    </td>
                    <#--<td>-->
                        <#--<label for="connectKey" class="control-label x85">验证码：</label>-->
                        <#--<input type="text" name="connectKey" id="connectKey" value="${(agent.connectKey)!}" data-rule="required" >-->
                    <#--</td>-->
                </tr>
                <tr>
                    <td>
                        <label for="version" class="control-label x85">版本：</label>
                        <input type="text" name="version" id="version" value="${(agent.version)!}"  >
                    </td>
                    <td>
                        <label for="groupType" class="control-label x85">分组：</label>
                    <#--<input type="text" name="groupId" id="groupId" value="${(agent.groupId)!}" data-rule="required" >-->
                        <select name="groupType" id="groupType" data-toggle="selectpicker">
                            <option value="">请选择</option>
                        <#list groupTypes as gtype>
                            <option value="${(gtype.value)!}" <#if gtype??&&agent.groupType??&&gtype.value==agent.groupType.value>selected</#if>>${(gtype.value)!}</option>
                        </#list>
                        </select>
                        <#--<@p.selector groupTypes 'name' 'name' agent 'groupType' 'groupTypeName'/>-->
                    </td>
                    <td>
                        <label for="bizUnitId" class="control-label x85">业务单元：</label>
                        <select name="bizUnitId" id="bizUnitId" data-toggle="selectpicker" onchange="$('#bizUnitName_').val(this.options[this.selectedIndex].text)">
                            <option value="">请选择</option>
                        <#list units as unit>
                            <option value="${(unit.id)!}" <#if unit??&&unit.id??&&agent.bizUnitId??&&unit.id==agent.bizUnitId>selected</#if>>${(unit.unitName)!}</option>
                        </#list>
                        </select>
                        <input type="hidden" name="bizUnitName" id="bizUnitName_" value="${(agent.bizUnitName)!}"  >
                    </td>
                </tr>
                <tr>
                <#--<td>-->
                <#--<label for="bizUnitName" class="control-label x85">业务单元名称：</label>-->
                <#--<input type="text" name="bizUnitName" id="bizUnitName" value="${(agent.bizUnitName)!}"  >-->
                <#--</td>-->
                    <td>
                        <label for="enable" class="control-label x85">是否启用：</label>
                        <select name="enable" id="enable" data-toggle="selectpicker" >
                            <option value="">请选择</option>
                            <option value="1" <#if agent.enable??&&agent.enable>selected</#if>>是</option>
                            <option value="0" <#if agent.enable??&&!agent.enable>selected</#if>>否</option>
                        </select>
                    <#--<input type="text" name="enable" id="enable" value="${(agent.enable)!}" data-rule="required" >-->
                    </td>
                    <td>
                        <label for="opSystem" class="control-label x85">操作系统：</label>
                        <@p.selector osTypes 'typeName' 'typeName' agent 'opSystem' 'opSystemName'/>
                    </td>

                 </tr>
                <tr>
                    <td>
                        <label for="userName" class="control-label x85">用户账号：</label>
                        <input type="text" name="userName" id="userName" value="${(agent.userName)!}"  >
                    </td>
                    <td>
                        <label for="password" class="control-label x85">密码：</label>
                        <input type="password" name="password" id="password" value="${(agent.password)!}"  onchange="javascript:genPass()">
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </form>
</div>
<div class="bjui-pageFooter" >
    <ul>
        <li><button type="button" class="btn btn-close" data-icon="close">取消</button></li>
        <li><button type="submit" class="btn btn-success" data-icon="save">保存</button></li>
    </ul>
</div>
<script>
    function genPass()
    {
        var pass = $('#password').val();
        $.ajax({
            url: "/admin/pass/encrypt"
            , type: "POST"
            , data: "pass="+pass
            , success: function( data, textStatus, jqXHR ){
                $('#password').val(data)
            }
        });
    }
</script>